let utilFun={
    formatDate(time){
        if (!time) return '';
        let date = new Date(time);

        return date.getFullYear() + '-' + utilFun.format2Date(date.getMonth() + 1) + '-' + utilFun.format2Date(date.getDate()) + ' '
            + utilFun.format2Date(date.getHours()) + ':' + utilFun.format2Date(date.getMinutes()) + ':'+ utilFun.format2Date(date.getSeconds())
    },
    format2Date(value)
    {
        if (value.toString().length === 2){
            return value
        }else {
            return '0'+value
        }
    },
    formatTimeStampToDate(timestamp){
        return new Date(timestamp)
    },
    pagination(data,callback){
        return {
            onChange:(current) => {
                callback(current)
            },
            current:data.data.page,
            pageSize:5,
            showTotal:() => {
                return `共${data.data.total}条`
                // return '共'+ data.total+'条'
            },
            total:data.data.total,
            showQuickJumper:true,
            showSizeChanger:false,
            pageSizeOptions:['5', '10', '15', '20']
        }
    }
}

export default utilFun